<%@page import="com.nxu.entity.OrderBean"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>书香阁 - 支付确认</title>
    <style>
        :root {
            --primary-color: #8d6e63;
            --light-gray: #f5f5f5;
            --dark-gray: #5a3921;
            --text-color: #333;
            --border-color: #d7ccc8;
            --success-color: #388e3c;
            --error-color: #d32f2f;
        }
        
        body {
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 0;
            background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), 
                        url('https://images.unsplash.com/photo-1507842217343-583bb7270b66?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80') no-repeat center center fixed;
            background-size: cover;
            color: var(--text-color);
        }
        
        .container {
            max-width: 800px;
            margin: 30px auto;
            background: rgba(255, 255, 255, 0.95);
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.2);
            backdrop-filter: blur(5px);
            animation: fadeIn 0.5s ease-in-out;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        h1 {
            text-align: center;
            color: var(--dark-gray);
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 2px solid var(--primary-color);
        }
        
        .order-info {
            margin: 30px 0;
            padding: 25px;
            background-color: rgba(141, 110, 99, 0.05);
            border-radius: 8px;
            border-left: 4px solid var(--primary-color);
        }
        
        .order-info h3 {
            color: var(--dark-gray);
            margin-top: 0;
            margin-bottom: 20px;
            font-size: 20px;
        }
        
        .order-info p {
            margin: 15px 0;
            display: flex;
        }
        
        .order-info strong {
            min-width: 100px;
            color: var(--dark-gray);
        }
        
        .form-group {
            margin-bottom: 25px;
        }
        
        label {
            display: block;
            margin-bottom: 10px;
            font-weight: 500;
            color: var(--dark-gray);
        }
        
        input[type="password"] {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            box-sizing: border-box;
            font-size: 16px;
            transition: all 0.3s;
        }
        
        input[type="password"]:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(141, 110, 99, 0.2);
            outline: none;
        }
        
        .btn {
            padding: 12px 25px;
            background-color: var(--success-color);
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        
        .btn:hover {
            background-color: #2e7d32;
            transform: translateY(-2px);
        }
        
        .error {
            color: var(--error-color);
            margin-top: 8px;
            font-size: 14px;
            padding: 8px;
            background-color: #ffebee;
            border-radius: 4px;
            border-left: 4px solid var(--error-color);
        }
        
        .card-mask {
            letter-spacing: 2px;
        }
        
        .payment-icon {
            text-align: center;
            font-size: 50px;
            color: var(--primary-color);
            margin-bottom: 20px;
        }
        
        @media (max-width: 768px) {
            .container {
                padding: 25px;
            }
            
            .order-info {
                padding: 15px;
            }
            
            .order-info p {
                flex-direction: column;
            }
            
            .order-info strong {
                margin-bottom: 5px;
            }
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body>
    <div class="container">
        <div class="payment-icon">
            <i class="fas fa-credit-card"></i>
        </div>
        <h1>支付确认</h1>
        
        <div class="order-info">
            <h3><i class="fas fa-receipt"></i> 订单信息</h3>
            <%
                OrderBean order = (OrderBean) session.getAttribute("currentOrder");
                if (order != null) {
            %>
            <p><strong><i class="fas fa-hashtag"></i> 订单编号：</strong> <%=order.getOrderId()%></p>
            <p><strong><i class="fas fa-money-bill-wave"></i> 总金额：</strong> ¥<%=String.format("%.2f", order.getTotalAmount())%></p>
            <p><strong><i class="fas fa-user"></i> 收货人：</strong> <%=order.getConsignee()%></p>
            <p><strong><i class="fas fa-phone"></i> 联系电话：</strong> <%=order.getPhone()%></p>
            <p><strong><i class="fas fa-credit-card"></i> 支付卡号：</strong> 
                <span class="card-mask">
                    <%=order.getCardNumber().substring(0, 4) + " **** **** " + order.getCardNumber().substring(order.getCardNumber().length()-4)%>
                </span>
            </p>
            <% } %>
        </div>
        
        <form action="<%=request.getContextPath()%>/PaymentServlet" method="post">
            <input type="hidden" name="orderId" value="<%=order != null ? order.getOrderId() : ""%>">
            
            <div class="form-group">
                <label for="cardPassword"><i class="fas fa-lock"></i> 支付密码：</label>
                <input type="password" id="cardPassword" name="cardPassword" required placeholder="请输入6位支付密码">
                <% if (request.getAttribute("paymentError") != null) { %>
                    <div class="error">
                        <i class="fas fa-exclamation-circle"></i> <%=request.getAttribute("paymentError")%>
                    </div>
                <% } %>
            </div>
            
            <button type="submit" class="btn">
                <i class="fas fa-check-circle"></i> 确认支付
            </button>
        </form>
    </div>
</body>
</html>